package com.dz.mapper;

import com.github.pagehelper.Page;
import com.dz.annotation.AutoFill;
import com.dz.dto.EmployeeDTO;
import com.dz.dto.EmployeePageQueryDTO;
import com.dz.dto.PasswordEditDTO;
import com.dz.entity.Employee;
import com.dz.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    @AutoFill(OperationType.INSERT)
    void insertEmployee(Employee employee);

    Page<Employee> selectEmployee(EmployeePageQueryDTO pageQueryDTO);

    Integer changeStatus(@Param("status") Integer status, @Param("id") Long id);

    Employee selectEmployeeById(Long id);

    Integer updateEmp(EmployeeDTO employeeDTO);

    Integer editPass(PasswordEditDTO passwordEditDTO);
}
